<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>催办记录</title>
    <link rel="stylesheet" href="css/common.css">
    <style>
        .top-navigation {
            display: flex;
            justify-content: space-between;
            padding: .2rem .8rem;
        }

        .top-navigation>h3 {
            font-size: .426667rem;
            font-family: PingFang SC;
            font-weight: bold;
        }

        .top-navigation .arrow {
            width: .533333rem;
            height: .426667rem;
        }

        .top-navigation .search {
            width: .533333rem;
            height: .533333rem;
            cursor: pointer;
        }



        .detail-info {
            margin-top: .666667rem;
        }

        .detail-info .label {
            margin-bottom: 20px;
            display: flex;
            justify-content: space-between;
        }

        .detail-info .label-title {
            width: 2.666667rem;
            height: 1.093333rem;
            color: #666666;
            line-height: 1.093333rem;
            padding-left: .4rem;
        }

        .detail-info .label-info {
            width: 7.333333rem;
            height: 1.093333rem;
            padding-left: .4rem;
            line-height: 1.093333rem;
            box-shadow: 0px 0px 24px 6px rgba(60, 99, 228, 0.08);
            border-radius: 5px;
            font-size: .373333rem;
            font-family: PingFang SC;
            font-weight: 400;
            color: #999999;
        }

        .detail-info>h3 {
            padding-left: .4rem;
            margin: 15px 0;
        }

        .detail-info>h3.duColor {
            color: #ff9e3a;
        }

        .detail-info>h3.resptColor {
            color: #0072ff
        }

        #submit-btn {
            width: 40%;
            height: .8rem;
            margin: 0 auto;
            color: #fff;
            background: linear-gradient(90deg, rgba(60, 99, 228, 1) 0%, rgba(123, 153, 251, 1) 100%);
            border-radius: 30px;
            border: none;
            outline: none;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div>
        <div class="top-navigation">
            <a href="./duTask.html"><img class="arrow" src="img/arrow.png" alt="图片加载中"></a>
            <h3>添加催办记录</h3>
            <p style="opacity: 0;"></p>
        </div>

        <div class="detail-info">
            <div class="label">
                <h3 class="label-title">督查方式</h3>
                <select id="methods" class="label-info" placeholder="督查方式">
                    <option value="">请选择您本次的督查方式</option>
                    <option value="AA">开展电话</option>
                    <option value="AB">现场督查</option>
                    <option value="AC">发出催办单或督办单</option>
                    <option value="AD">找出项目存在问题</option>
                    <option value="AE">进行约谈</option>
                    <option value="AF">提出处理意见</option>
                </select>
            </div>
            <div class="label">
                <h3 class="label-title">节点情况</h3>
                <input class="label-info node-situation" type="text" disabled value="111">
            </div>
            <div class="label">
                <h3 class="label-title">督查情况</h3>
                <textarea id="situations" class="label-info" style="height: 150px;" placeholder="请填写督查情况"></textarea>
            </div>
        </div>
        <div align="center">
            <button id="submit-btn">添加催办记录</button>
        </div>
    </div>
    <!-- 督查记录 -->
    <div class="recorder-content">
        <!-- <div class="detail-info">
            <h3 class="duColor">督查组督查记录:</h3>
            <div class="label">
                <h3 class="label-title">日志时间</h3>
                <input class="label-info" type="text" disabled>
            </div>
            <div class="label">
                <h3 class="label-title">督查方式</h3>
                <input class="label-info" type="text" disabled>
            </div>
            <div class="label">
                <h3 class="label-title">督查情况</h3>
                <textarea class="label-info" style="height: 100px;" disabled></textarea>
            </div>
        </div>



        <div class="detail-info">
            <h3 class="resptColor">责任单位反馈记录:</h3>
            <div class="label">
                <h3 class="label-title">日志时间</h3>
                <input class="label-info" type="text" disabled>
            </div>
            <div class="label">
                <h3 class="label-title">完成情况</h3>
                <textarea class="label-info" style="height: 100px;" disabled></textarea>
            </div>
        </div> -->
    </div>




    <script src="js/flexible.js"></script>
    <script src="js/jquery-3.2.1.js"></script>
    <!-- VConsole手机调试 -->
    <!-- <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script> -->
    <script>
        // var vConsole = new VConsole();

        $(function () {
            var search = location.search;
            var sysId = search.split("=")[1].slice(0, 20);
            var isHide = search.split("=")[2];
            // 获取用户电话号码
            var userPhone = window.AndroidWebView.getUserId();

            loadRecorder();
            //请求日志
            function loadRecorder() {
                $.ajax({
                    // url: "https://www.fzzhengxinyun.com/zhApp/supervisionTask/lists",
                    url: "http://120.78.158.120:8099/zhApp/supervisionTask/queryTaskLogs",
                    type: "POST",
                    dataType: "json", //返回数据形式为json
                    contentType: 'application/json;charset=UTF-8',
                    data: JSON.stringify({
                        "userPhone": userPhone,
                        "sysId": sysId
                    }),
                    success: function (res) {
                        console.log(res);
                        if (res.code === "200" && res.data !== undefined) {
                            console.log(res);
                            var item = res.data;
                            var html = "";
                            for (var i = 0; i < item.length; i++) {
                                if (item[i].supervisionTeamId === undefined) {
                                    html = '\
                                <div class="detail-info">\
                                    <h3 class="duColor">督查组督查记录:</h3>\
                                    <div class="label">\
                                        <h3 class="label-title">日志时间</h3>\
                                        <input class="label-info" type="text" disabled value="' + item[i].createDate +
                                        +" " + item[i].createTime + '">\
                    </div>\
                    <div class="label">\
                        <h3 class="label-title">督查方式</h3>\
                        <input class="label-info" type="text" disabled value="' + item[i].methonName + '">\
                    </div>\
                    <div class="label">\
                        <h3 class="label-title">督查情况</h3>\
                        <textarea class="label-info" style="height: 100px;" disabled>' + item[i]
                                        .supervisionAsk + '</textarea>\
                    </div>\
                    </div>\
                    ';
                                } else {
                                    html = '\
                    <div class="detail-info">\
                        <h3 class="resptColor">责任单位反馈记录:</h3>\
                        <div class="label">\
                            <h3 class="label-title">日志时间</h3>\
                            <input class="label-info" type="text" disabled value="' + item[i].createDate + " " +
                                        item[i]
                                        .createTime + '">\
                        </div>\
                        <div class="label">\
                            <h3 class="label-title">完成情况</h3>\
                            <textarea class="label-info" style="height: 100px;" disabled>' + item[i]
                                        .record + '</textarea>\
                        </div>\
                    </div>\
                    ';
                                }

                                $(".recorder-content").append(html);
                            }


                        }

                        if (res.data === undefined) {
                            $(".noData").css("display", "block");
                        }
                    }
                });
            }

            // 请求节点情况

            $.ajax({
                url: "http://120.78.158.120:8099/zhApp/supervisionTask/queryNodeDetail",
                type: "POST",
                dataType: "json", //返回数据形式为json
                contentType: 'application/json;charset=UTF-8',
                data: JSON.stringify({
                    "userPhone": userPhone,
                    "sysId": sysId
                }),
                success: function (res) {
                    if (res.code === "200") {
                        $(".node-situation").val(res.message);
                    }


                }
            });

            // 添加催办记录
            $("#submit-btn").click(function () {
                var siuation = $("#situations").val(); //情况
                var methods = $("#methods option:selected").val(); //督查方式
                if (siuation === "" || methods === "") {
                    alert("督查方式和督查情况不能为空");
                } else {
                    $.ajax({
                        url: "http://120.78.158.120:8099/zhApp/supervisionTask/createTaskLog",
                        type: "POST",
                        dataType: "json", //返回数据形式为json
                        contentType: 'application/json;charset=UTF-8',
                        data: JSON.stringify({
                            "taskId": sysId,
                            "methonCode": methods,
                            "supervisionAsk": siuation
                        }),
                        success: function (res) {
                            console.log("添加成功");
                            console.log(res);
                            if (res.code === "200") {
                                alert("添加催办记录成功");
                                loadRecorder();
                            } else {
                                alert("添加催办记录失败");
                            }


                        }
                    });
                }
            });

        })
    </script>
</body>

</html>